README
======

This repository contains code and supporting files for the paper "The Importance of Student-Teacher Matching: A
Multidimensional Value-Added Approach".

In the Harvard Dataverse data repository upload, we could not replicate the folder structure required for the code. Instead, interested users should create the following folders:

cfr test
estimation
matlab functions
NC Data
output
tables and figures

Within the "output" folder, the following sub-folders should be created:

main
model selection
reallocation

Within the "tables and figures" folder, the following sub-folders should be created:

graphics
tables

These folders should be populated with files in the data repository. The "tags" for each file identifies the the folder in which it belongs.

Folder Structure and Usage Notes
--------------------------------

1. NC Data/
   - Must be run before all other programs.
   - Contains programs for preparing the raw data.
   - The four R files S1*.R to S4*.R should be run in sequence to prepare the dataset for estimation.
   - The final output will be a CSV file named "SCC_4to5.csv".

2. estimation/
   - Contains the programs that produce the main results.
   - model_selection.m conducts model selection.
   - est_main.m estimates the main matching specification and level-only models for both reading and math.
   - reallocation.m performs the reallocation exercises.
   - These scripts rely on helper functions stored in the "Matlab functions/" folder.
   - All output from these scripts is saved in the "output/" folder.

3. Matlab functions/
   - Collection of helper functions used by the estimation code.
   - These are not meant to be run directly, but are called from scripts in "estimation/".

4. output/
   - Stores all generated output from the estimation programs.

5. tables and figures/
   - Contains programs that generate the tables and figures for the paper.
   - These scripts use the results stored in "output/" as input.

6. cfr test/
   - Uses the output from est_main.m.
   - test data.m creates the data for the CFR test.
   - cfr.R runs the regressions for the test.
